package com.lizhi.yun.db.msb.entity;/**
 * @program: msb
 * @name MsbManualEntity
 * @description: 手动刺激
 * @author: lizhi
 * @create: 2021-12-08 14:51
 */

import com.lizhi.mybatis.boot.Description;
import com.lizhi.yun.db.msb.enums.MsbTrStatusEnum;
import com.lizhi.yun.db.msb.enums.MsbTreatTypeEnum;
import lombok.Data;
import lombok.ToString;

import javax.persistence.*;

/**
 *@program: msb
 *@name MsbManualEntity
 *@description: 手动刺激
 *@author: lizhi
 *@create: 2021-12-08 14:51
 */
@Data
@ToString
@Table(name = "msb_treat_record")
@Entity
@Description("治疗记录")
public class MsbTreatRecordEntity extends AbstractEntity{

    @Id
    @Column(columnDefinition="varchar(30) COMMENT 'id'")
    public String lid;

    @Column(columnDefinition="varchar(30) COMMENT '记录id'")
    public String trId;

    @Column(columnDefinition="varchar(30) COMMENT '患者id'")
    public String ptId;

    @Column(columnDefinition="varchar(2) COMMENT '治疗类型'")
    public String trType;

    @Transient
    public String trTypeText;

    @Column(columnDefinition="int(11) COMMENT '刺激强度（A%）'")
    public int trIntensity;

    @Column(columnDefinition="int(11) COMMENT '刺激阈值（%）'")
    public int trThreshold;

    @Column(columnDefinition="int(11) COMMENT '刺激频率（Hz）'")
    public int trFrequency;

    @Column(columnDefinition="int(11) COMMENT '连续刺激个数（C）'")
    public int trConNum;

    @Column(columnDefinition="int(11) COMMENT '间隔时间（秒）（Ds）'")
    public int trPeriod;

    @Column(columnDefinition="int(11) COMMENT '重复次数'")
    public int trRepeat;

    @Column(columnDefinition="int(11) COMMENT '总刺激个数'")
    public int trTotal;

    @Column(columnDefinition="int(11) COMMENT '已刺激个数'")
    public int trAlready;

    @Column(columnDefinition="int(11) COMMENT '总治疗时间(秒)'")
    public int trDate;

    @Column(columnDefinition="varchar(500) COMMENT '总治疗时间(秒)'")
    public String trTms;

    @Column(columnDefinition="varchar(19) COMMENT '治疗开始时间'")
    public String trStartTm;

    @Column(columnDefinition="varchar(19) COMMENT '治疗结束时间'")
    public String trEndTm;

    @Column(columnDefinition="varchar(2) COMMENT '训练状态'")
    public String trStatus;

    @Transient
    public String trStatusText;

    @Transient
    public MsbPatientEntity msbPatientEntity;

    public String getTrTypeText() {
        if (MsbTreatTypeEnum.Type_01.getEnValue().equals(this.trType)){
            this.trTypeText = MsbTreatTypeEnum.Type_01.getEnName();
        } else if (MsbTreatTypeEnum.Type_00.getEnValue().equals(this.trType)){
            this.trTypeText = MsbTreatTypeEnum.Type_00.getEnName();
        }
        return trTypeText;
    }

    public String getTrStatusText() {
        if (MsbTrStatusEnum.Status_00.getEnValue().equals(this.trStatus)){
            this.trStatusText = MsbTrStatusEnum.Status_00.getEnName();
        } else if (MsbTrStatusEnum.Status_01.getEnValue().equals(this.trStatus)){
            this.trStatusText = MsbTrStatusEnum.Status_01.getEnName();
        }
        return trStatusText;
    }
}
